import 'package:flutter/material.dart';
///网络错误显示
class DefaultErrorIndicator extends StatelessWidget {
  const DefaultErrorIndicator({
    super.key,
    required this.errorMessage,
    required this.onRefreshTap,
  });

  final String errorMessage;
  final VoidCallback onRefreshTap;

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          const Icon(
            Icons.error_outline,
            color: Colors.red,
            size: 48,
          ),
          const SizedBox(height: 16),
          Text(
            errorMessage,
            style: const TextStyle(
              color: Colors.white70,
              fontSize: 16,
            ),
            textAlign: TextAlign.center,
          ),
          const SizedBox(height: 16),
          ElevatedButton(
            onPressed: onRefreshTap,
            child: const Text('重试'),
          ),
        ],
      ),
    );
  }
}
